<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePluginTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (! Schema::hasTable('plugin')) {
            Schema::create('plugin', function (Blueprint $table) {
                $table->comment('插件表');
                $table->increments('id');
                $table->string('name', 32)->default('')->unique('name')->comment('插件标志');
                $table->string('title', 32)->default('')->comment('插件名称');
                $table->text('description')->comment('插件描述');
                $table->string('author', 32)->default('')->comment('作者');
                $table->string('version', 16)->comment('版本号');
                $table->integer('sort')->default(100)->comment('排序');
                $table->boolean('status')->default(true)->comment('状态');
                $table->boolean('install')->default(true)->comment('是否安装');
                $table->text('conf')->comment('插件配置');
                $table->timestamp('created_at')->comment('安装时间');
                $table->timestamp('updated_at')->nullable()->comment('更新时间');
                $table->timestamp('deleted_at')->nullable()->comment('删除时间');
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('plugin');
    }
};
